<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>13-5 深拷贝：JSON.parse和JSON.stringify</title>
</head>

<body>
  <script>
    // 对象
    let obj1 = {
      name: "Henry",
      course: {
        c1: "JavaScript",
        c2: "PHP"
      },
      n: null,
      r: /^\d+$/,
      f: function () { },
      u: undefined,
      d: new Date(),
      s: Symbol("xxx"),
      m: Math,
      // b: 22n 无法处理
    }

    let obj2 = JSON.parse(JSON.stringify(obj1))

    console.log(obj2)
    console.log(obj1 === obj2) //=> false
    console.log(obj1.course === obj2.course) //=> false
  </script>
</body>

</html>